package org.dtrd.modules.device.service;

import org.dtrd.common.api.vo.Result;
import org.dtrd.modules.device.entity.po.DtrdEntRdDevice;
import com.baomidou.mybatisplus.extension.service.IService;

import java.util.List;

import org.dtrd.modules.device.entity.bean.DeviceDetail;
import org.dtrd.modules.device.entity.bean.DeviceListInfo;

import com.baomidou.mybatisplus.core.metadata.IPage;
import org.dtrd.modules.device.entity.request.BindDeviceRequest;
import org.dtrd.modules.device.entity.request.DeviceListRequest;
import org.dtrd.modules.device.entity.request.DevicePageRequest;

/**
 * <p>
 * 服务类
 * </p>
 *
 * @author xiao
 * @since 2022-01-11
 */
public interface IDtrdEntRdDeviceService extends IService<DtrdEntRdDevice> {

    List<DeviceListInfo> getDeviceList(DeviceListRequest request);

    IPage<DeviceListInfo> pageDevice(DevicePageRequest request);

    DeviceDetail getDevice(Integer dataId);

    boolean saveOrUpdateDevice(DeviceDetail dto);

    boolean removeDevice(Integer dataId);

    Result<?> bindDevice(BindDeviceRequest request);

    DtrdEntRdDevice selectOntByDeviceSnAndDeviceType(String serialNumber, Integer deviceBrand, Integer deviceCategory);

    /**
     * 查询用户绑定记录
     *
     * @param patientId
     * @param deviceCategory
     * @return
     */
    DtrdEntRdDevice getBindRecord(Integer patientId, Integer deviceBrand, Integer deviceCategory);

    /**
     * 微策数据一致性校验
     *
     * @param signature
     * @param body
     * @return
     */
    boolean checkWeiceSignature(String signature, String body);

    /**
     * 查询用户绑定的设备记录
     *
     * @param patientId
     * @return
     */
    List<DeviceListInfo> getBindDevice(Integer patientId);
}
